/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package assignment2.data;

import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author tuan
 */
@Stateless
public class ProductsFacade extends AbstractFacade<Products> {
    @PersistenceContext(unitName = "Assignment2-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }
    
    public ProductsFacade() {
        super(Products.class);
    }

    public List<Products> searchByCategoryID(String categoryID) {
        Query query = em.createNamedQuery("Products.findByCategoryID");
        query.setParameter("categoryID", categoryID);
        return query.getResultList();
        
    }

    public void modifyProduct(String productID, String productName,
            String categoryID, float unitPrice, int unitInStocks, 
            int unitInOrder, String productImage, String description) {
    }
    
    
    
}
